package beanAction;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import packhib.EmployeDAO;

import com.opensymphony.xwork2.ActionSupport;

public class RechercheNom extends ActionSupport{
	
	List liseEmploy=new ArrayList<Employe>();
	List listEmploy=new ArrayList<Employe>();
	private List<String> listeDNom;
   String yourLuckyName;
   ArrayList distinctList;
	
	

   public ArrayList getDistinctList() {
	return distinctList;
}
public void setDistinctList(ArrayList distinctList) {
	this.distinctList = distinctList;
}
public List<String> getListeDNom() {
		return listeDNom;
	}
	public void setListeDNom(List<String> listeDNom) {
		this.listeDNom = listeDNom;
	}

	public List getLiseEmploy() {
		return liseEmploy;
	}


	public void setLiseEmploy(List liseEmploy) {
		this.liseEmploy = liseEmploy;
	}


	public String getYourLuckyName() {
		return yourLuckyName;
	}


	public void setYourLuckyName(String yourLuckyName) {
		this.yourLuckyName = yourLuckyName;
	}


	public List chercherEmployeWithName(String name)
	{
		EmployeDAO emp=new EmployeDAO();
		liseEmploy =emp.findByNom(name);
		System.out.println("namerrrrrr "+yourLuckyName);
		return liseEmploy;
		
	}
	//RechercheSimpleAction rsa=new RechercheSimpleAction();
	
	public String appelChercherEmplWName()
	{
		System.out.println("name= "+yourLuckyName);
		listEmploy=chercherEmployeWithName(yourLuckyName);	
		test();
		 return "success";
	}
	
	 public String  test()
		{
			System.out.println("iwiwiwiiw ");
		    EmployeDAO enmpdao=new EmployeDAO();
		    listeDNom=enmpdao.getNomEmployes();
		    Set set = new HashSet() ;
	        set.addAll(listeDNom) ;
	        distinctList = new ArrayList(set) ;
		   
		  return "success";
	  }
	public List getListEmploy() {
		return listEmploy;
	}
	public void setListEmploy(List listEmploy) {
		this.listEmploy = listEmploy;
	}
	
}
